package com.wayhome.srpingbootmybatis.policy.dto;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;

import java.util.Date;
import java.util.List;

@Data
@ApiModel(value = "政策文件管理")
public class PolicyDocDTO {

    @ApiModelProperty(value = "主键ID")
    private Long id;

    @ApiModelProperty(value = "政策类别 1:待遇类 2:价格类 3:支付类 4:目录类 5:综合类 6:征缴类 99:其他政策类别 1:待遇类 2:价格类 3:支付类 4:目录类 5:综合类 6:征缴类 99:其他")
    private String policyType;

    @ApiModelProperty(value = "年份")
    private String policyYear;

    @ApiModelProperty(value = "文号")
    private String docNo;

    @ApiModelProperty(value = "文件名称")
    private String docName;

    @ApiModelProperty(value = "具体发文时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date pubDate;

    @ApiModelProperty(value = "发文单位")
    private String pubDept;

    @ApiModelProperty(value = "是否补充或调整")
    private String suptFlag;

    @ApiModelProperty(value = "补充或调整对应的文号")
    private String suptDocNo;

    @ApiModelProperty(value = "文件有效时限")
    private String docLmtPeriod;

    @ApiModelProperty(value = "是否在有效期内")
    private String effectiveFlag;

    @ApiModelProperty(value = "是否上传附件")
    private String uploadFlag;

    @ApiModelProperty(value = "区划")
    private String admdvs;

    @ApiModelProperty(value = "备注")
    private String memo;

    @ApiModelProperty(value = "有效标志")
    private String valiFlag;

    @ApiModelProperty(value = "要删除的附件id")
    private List<Long> delFileIds;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "数据创建时间")
    private Date crteTime;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "数据更新时间")
    private Date updtTime;

    @ApiModelProperty(value = "创建人ID")
    private String crterId;

    @ApiModelProperty(value = "创建人姓名")
    private String crterName;

    @ApiModelProperty(value = "创建机构编号")
    private String crteOptinsNo;

    @ApiModelProperty(value = "经办人ID")
    private String opterId;

    @ApiModelProperty(value = "经办人姓名")
    private String opterName;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "经办时间")
    private Date optTime;

    @ApiModelProperty(value = "经办机构编号")
    private String optinsNo;

    @ApiModelProperty(value = "上传的文件")
    private MultipartFile[] files;

    @ApiModelProperty(value = "上传的文件")
    private List<SimplePolicyDocFile> fileList;

    //设置新增时的默认参数
    public void setDefaultInsertParam() {
        //上传文件标志
        setUploadFlag("0");
        //区划
        String defaultAdmdvs = "130000";
        this.admdvs = defaultAdmdvs;
        //有效标志
        valiFlag = "1";
        //时间
        Date now = new Date();
        //创建时间
        this.crteTime = now;
        //更新时间
        this.updtTime = now;
        //经办时间
        this.optTime = now;

        String userAcct = "system";
        String userName = "系统";
        String optinNo = "S13000010001";
        //创建人
        this.crterId = userAcct;
        this.crterName = userName;
        this.crteOptinsNo = optinNo;
        //经办人
        this.opterId = userAcct;
        this.opterName = userName;
        this.optinsNo = optinNo;
    }

}
